package com.huaxia.service.A_updateFHS;

import com.huaxia.dao.A_updateFHS.FHAgentGradeMapper;
import com.huaxia.dao.A_updateFHS.QuarterFHSMapper;
import com.huaxia.pojo.A_updateFHS.QuarterFHS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wangli 爱我华夏，爱我中华！
 * @date 2020/08/14 9:55
 */
@Service
public class QuarterFHSService {

    @Autowired
    private QuarterFHSMapper quarterFHSMapper;
    @Autowired
    private FHAgentGradeMapper fhAgentGradeMapper;

    public List<QuarterFHS> getFHAgentGrade(){
        return fhAgentGradeMapper.getFHAgentGrade();
    }

    public void deleteQuarterFHS(){
         quarterFHSMapper.deleteQuarterFHS();
    }

    public void updateFHS(){
        deleteQuarterFHS();
        List<QuarterFHS> quarterFHSs = getFHAgentGrade();
        if(quarterFHSs.size()>0) {
            for (QuarterFHS fhSs : quarterFHSs) {
                quarterFHSMapper.FHSInsert(fhSs.getAgentCode(),fhSs.getManageCom(),fhSs.getFhAgentGrade());
            }
        }
    }
}
